/*
 * util_number.h
 *
 *  Created on: 2012-8-30
 *      Author: lin
 */

#ifndef UTIL_NUMBER_H_
#define UTIL_NUMBER_H_

#include "def/defs.h"

static inline uint32_t number_next_power(uint32_t c,uint32_t min,uint32_t max) {
    uint32_t i = min;
    if (c >= max) {
        return max;
    }
    while (i < c) {
        i <<= 1;
    }
    return i >= max ? max : i;
}
#endif /* UTIL_NUMBER_H_ */
